CC=g++
CFLAGS=-O2

BIN=../bin/
ULIB_DIR=/home/swlee4skmt/.lib/ulib_/
#ULIB_DIR=/Users/windnc/.lib/ulib_/
#ULIB_DIR=../

ULIB_INC=-I${ULIB_DIR}include
ULIB_OBJ=${ULIB_DIR}lib/ulib.a
OBJ=copycat.o copycat-train.o copycat-test.o util.o tree.o giza.o rule.o sent.o

all: ${OBJ}

	${CC} ${CFLAGS} copycat-main.cpp -o ${BIN}copycat-cr ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} copycat-rf-main.cpp -o ${BIN}copycat-rf ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} copycat-train-main.cpp -o ${BIN}copycat-train ${OBJ} ${ULIB_OBJ} ${ULIB_INC}

util: ${OBJ}
	${CC} ${CFLAGS} recov-re.cpp -o ${BIN}recov-re ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} giza2plain.cpp -o ${BIN}giza2plain ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} snt-compare.cpp -o ${BIN}snt-compare ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} corpus-stat.cpp -o ${BIN}corpus-stat ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} rule-eval.cpp -o ${BIN}rule-eval ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} rule-compare.cpp -o ${BIN}rule-compare ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} tree-inspector.cpp -o ${BIN}tree-inspector ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} crossnum.cpp -o ${BIN}crossnum ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} nao2giza.cpp -o ${BIN}nao2giza ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} recov-re.cpp -o ${BIN}recov-re ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
	${CC} ${CFLAGS} recov-re-tgt.cpp -o ${BIN}recov-re-tgt ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
#	${CC} ${CFLAGS} cmp_line.cpp -o ${BIN}cmp_line ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
#	${CC} ${CFLAGS} wa-inspector.cpp -o ${BIN}wa-inspector ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
#	${CC} ${CFLAGS} tree_conv_main.cpp -o ${BIN}tree_conv ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
#	${CC} ${CFLAGS} hrule.cpp -o ${BIN}hrule ${OBJ} ${ULIB_OBJ} ${ULIB_INC}
#	${CC} ${CFLAGS} ins.cpp -o ${BIN}ins ${OBJ} ${ULIB_OBJ} ${ULIB_INC}


.cpp.o:
	${CC} ${CFLAGS} -c $< -o $*.o ${ULIB_INC} ${ULIB_OBJ}

clean:
	rm -rf *.o
	rm -rf ${BIN}copycat ${BIN}tree_conv ${BIN}cmp_line ${BIN}recov-re ${BIN}wa-inspector

co:
	svn co $$svn_ulib
	cd ulib; make; make install; cd ..
